package models;

import java.util.ArrayList;
import java.util.List;

import metamodels.Metamodel;

import parser.generic.Node;

public class Instances extends Node {

	private List<Instance> instances;

	public Instances() {
		instances = new ArrayList<Instance>();
	}

	public void addInstance(Instance data) {
		instances.add(data);
	}

	@Override
	public String toString() {
		String out = "";

		for (Instance i : instances)
			out += i + "\n\n";

		return out;
	}

	public String getObjectNames() {
		String out = "";

		for (Instance i : instances)
			out += " | " + i.getName();

		return out;
	}

	public String toK(Metamodel metamodel, String deep) {
		String out = deep + "<instances>\n";

		for (Instance i : instances)
			out += i.toK(deep + "\t") + "\n";

		out += "\n" + deep + "</instances>";
		return out;
	}
}
